﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Workflow.ComponentModel;
using System.Diagnostics;

namespace ExternalActivities
{
    public class GetAccumulatedValueActivity : Activity
    {
        public GetAccumulatedValueActivity()
        {
        }

        public GetAccumulatedValueActivity( string name ) : base( name )
        {
        }

        public decimal Sum { get; private set; }

        protected override ActivityExecutionStatus Execute( ActivityExecutionContext aec )
        {
            SomeTransactionalService svc = aec.GetService<SomeTransactionalService>();

            Debug.Assert( svc != null );

            this.Sum = svc.Sum;

            return ActivityExecutionStatus.Closed;
        }
    }
}
